
###############################
# Power Analysis
###############################
library(InteractionPoweR)

# Two-way interactions =========================================================
power_interaction_r2(
  alpha = 0.05,
  N = 779, # smallest analyitical sample
  r.x1.y=.1, # small effect
  r.x2.y=.1, # small effect
  r.x1.x2=.1, # small effect
  r.x1x2.y = seq(0.05, .15, by=.005) # 2-way interaction 
)

# Three-way interaction ========================================================
power_interaction_3way_r2(
  alpha = 0.05,
  N = 779,  # Sample size
  b.x1x2x3 =seq(0.05, .15, by=.005) ,  # 3-way interaction 
  r.x1.y = 0.1, 
  r.x2.y = 0.1,  
  r.x3.y  =  0.1,  
  r.x1x2.y =  0.1, 
  r.x1x3.y =  0.1,  
  r.x2x3.y  =  0.1, 
  r.x1.x2  =  0.63, # Correlation between InterestedNum and pos_id_mean
  r.x1.x3  =  0.14,  # Correlation between InterestedNum and neg_id_mean
  r.x2.x3  =  0.515, # Correlation between pos_id_mean and neg_id_mean
  )
